home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / include / user / RCS / proc.h,v < prev    next >
Encoding:
Text File  |  1992-07-17  |  25.0 KB  |  895 lines

  1. head     1.8;
  2. branch   ;
  3. access   ;
  4. symbols  srv030:1.8 srv027:1.8 srv026:1.8 srv024:1.8 srv021:1.8 srv019:1.8 srv018:1.8 srv016:1.8 srv014:1.8 srv010:1.7 srv008:1.7 srv007:1.7 srv006:1.7 srv005:1.7 srv004:1.7 srv003:1.7 srv002:1.7 srv001:1.7;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.8
  10. date     92.06.10.15.17.31;  author kupfer;  state Exp;
  11. branches ;
  12. next     1.7;
  13.  
  14. 1.7
  15. date     92.03.12.20.45.07;  author kupfer;  state Exp;
  16. branches ;
  17. next     1.6;
  18.  
  19. 1.6
  20. date     92.02.28.19.54.20;  author kupfer;  state Exp;
  21. branches ;
  22. next     1.5;
  23.  
  24. 1.5
  25. date     91.12.18.21.46.01;  author kupfer;  state Exp;
  26. branches ;
  27. next     1.4;
  28.  
  29. 1.4
  30. date     91.10.04.11.53.14;  author kupfer;  state Exp;
  31. branches ;
  32. next     1.3;
  33.  
  34. 1.3
  35. date     91.09.24.19.48.20;  author kupfer;  state Exp;
  36. branches ;
  37. next     1.2;
  38.  
  39. 1.2
  40. date     91.09.01.21.15.32;  author kupfer;  state Exp;
  41. branches ;
  42. next     1.1;
  43.  
  44. 1.1
  45. date     91.08.15.18.33.07;  author kupfer;  state Exp;
  46. branches ;
  47. next     ;
  48.  
  49.  
  50. desc
  51. @User-visible declarations for processes.
  52. @
  53.  
  54.  
  55. 1.8
  56. log
  57. @Add Proc_StringOffset, Proc_OffsetTable, and Proc_Strings.
  58. @
  59. text
  60. @/*
  61.  * proc.h --
  62.  *
  63.  *    User-visible declarations for processes.
  64.  *
  65.  * Copyright 1986, 1988, 1991 Regents of the University of California
  66.  * Permission to use, copy, modify, and distribute this
  67.  * software and its documentation for any purpose and without
  68.  * fee is hereby granted, provided that this copyright
  69.  * notice appears in all copies.  The University of California
  70.  * makes no representations about the suitability of this
  71.  * software for any purpose.  It is provided "as is" without
  72.  * express or implied warranty.
  73.  *
  74.  * $Header: /user5/kupfer/spriteserver/include/user/RCS/proc.h,v 1.7 92/03/12 20:45:07 kupfer Exp Locker: kupfer $ SPRITE (Berkeley)
  75.  */
  76.  
  77. #ifndef _PROCUSER
  78. #define _PROCUSER
  79.  
  80. #include <mach/thread_status.h>
  81.  
  82. /*
  83.  * Process Termination Reason flags:
  84.  *
  85.  *   PROC_TERM_EXITED        - The process has called Proc_Exit.
  86.  *   PROC_TERM_DETACHED        - The process has called Proc_Detach.
  87.  *   PROC_TERM_SIGNALED        - The process has died because of a signal.
  88.  *   PROC_TERM_DESTROYED    - The process has died because the internal
  89.  *                  state of the process was found to be
  90.  *                  invalid.
  91.  *   PROC_TERM_SUSPENDED    - The process has been suspended.
  92.  *   PROC_TERM_RESUMED        - The process has resumed execution as the
  93.  *                  result of a resume signal.
  94.  */
  95.  
  96. #define PROC_TERM_EXITED        1
  97. #define PROC_TERM_DETACHED        2
  98. #define PROC_TERM_SIGNALED        3
  99. #define PROC_TERM_DESTROYED        4
  100. #define    PROC_TERM_SUSPENDED        5
  101. #define    PROC_TERM_RESUMED        6
  102.  
  103. /*
  104.  * Reasons why a process was destroyed (PROC_TERM_DESTROYED):
  105.  * 
  106.  * PROC_BAD_STACK        - A process's user stack is invalid upon
  107.  *                  return from a signal handler.
  108.  * PROC_BAD_PSW         - The processor status word that is to be
  109.  *                  restored upon return from a signal handler
  110.  *                  has the supervisor bit set.
  111.  * PROC_VM_READ_ERROR        - The virtual memory system couldn't read from
  112.  *                  the page server.
  113.  * PROC_VM_WRITE_ERROR        - The virtual memory system couldn't write to
  114.  *                  the page server.
  115.  * PROC_EXEC_FAILED        - An exec call failed after the process's 
  116.  *                   state had been irretrievably munged.
  117.  * PROC_MACH_FAILURE        - An operation on the process's task or 
  118.  *                   thread failed unexpectedly.
  119.  */
  120.  
  121. #define    PROC_BAD_STACK            1
  122. #define    PROC_BAD_PSW            2
  123. #define    PROC_VM_READ_ERROR        3
  124. #define    PROC_VM_WRITE_ERROR        4
  125. #define PROC_EXEC_FAILED        5
  126. #define PROC_MACH_FAILURE        6
  127.  
  128. #ifndef _ASM
  129. /*
  130.  *  Definition of a process ID.
  131.  */
  132.  
  133. typedef unsigned int     Proc_PID;
  134.  
  135.  
  136.  
  137. /*
  138.  * Special values to indicate the pid of the current process, or the host on
  139.  * which it is running, respectively.
  140.  */
  141.  
  142. #define PROC_MY_PID    ((Proc_PID) 0xffffffff)
  143. #define PROC_MY_HOSTID    ((unsigned int) 0xffffffff)
  144.  
  145. /*
  146.  * Mask to extract process table index from pid.
  147.  */
  148. #define    PROC_INDEX_MASK        0x000000FF
  149.  
  150. /*
  151.  * Convert a process id into a process table index.
  152.  */
  153. #define    Proc_PIDToIndex(pid) ((pid) & PROC_INDEX_MASK)
  154.  
  155. /*
  156.  * Special parameter to Proc_Migrate to evict all processes from a
  157.  * workstation.
  158.  */
  159.  
  160. #define PROC_ALL_PROCESSES    ((Proc_PID) 0)
  161.  
  162. /*
  163.  * Special family value to indicate the process isn't in a family and 
  164.  * a macro to see if the process is in a family.
  165.  */
  166.  
  167. #define PROC_NO_FAMILY    (Proc_PID) -1
  168. #define Proc_In_A_Family(familyID) ((familyID) != PROC_NO_FAMILY)
  169.  
  170.  
  171. /*
  172.  * PROC_SUPER_USER_ID is the user ID of the omnipotent super-user and 
  173.  * PROC_NO_ID is used when specifying no id to the Proc_SetIDs call.
  174.  */
  175.  
  176. #define PROC_SUPER_USER_ID      0
  177. #define PROC_NO_ID          -1
  178.  
  179. /*
  180.  * PROC_NO_INTR_PRIORITY is used to provide system processes 
  181.  *  infinitely-high priority.
  182.  */
  183.  
  184. #define PROC_MIN_PRIORITY    -2
  185. #define PROC_MAX_PRIORITY     2
  186.  
  187. #define PROC_NO_INTR_PRIORITY     2
  188. #define PROC_HIGH_PRIORITY     1
  189. #define PROC_NORMAL_PRIORITY     0
  190. #define PROC_LOW_PRIORITY    -1
  191. #define PROC_VERY_LOW_PRIORITY    -2
  192.  
  193. /*
  194.  *  Possible states for a process.
  195.  */
  196.  
  197. typedef enum {
  198.     PROC_UNUSED,    /* The process doesn't exist yet. */
  199.     PROC_RUNNING,        /* unused; kept for compatibility */
  200.     PROC_READY,        /* The process is ready to execute. */
  201.     PROC_WAITING,    /* The process is waiting for an event to occur such
  202.              * as I/O completion or a mutex lock released. */
  203.     PROC_EXITING,    /* The process has terminated and is on the 
  204.              * exiting list. */
  205.     PROC_DEAD,        /* The process has been terminated is on the dead list*/
  206.     PROC_MIGRATED,    /* The process is running on a remote machine. */
  207.     PROC_NEW,        /* The process was just created. */
  208.     PROC_SUSPENDED    /* The process is suspended. */
  209. } Proc_State;
  210.  
  211. #define PROC_NUM_STATES    (PROC_SUSPENDED + 1) /* number of different 
  212.                           * process states */
  213.  
  214. #endif /* _ASM */
  215.  
  216.  
  217. /*
  218.  * Process attributes flags:
  219.  *
  220.  *  PROC_KERNEL               - The process is a kernel process.
  221.  *  PROC_USER                 - The process is a user process.
  222.  *  PROC_DEBUGGED        - The process is being debugged by the system
  223.  *                  debugger.
  224.  *  PROC_DEBUG_ON_EXEC        - The process will start in debugged mode.
  225.  *  PROC_DEBUG_WAIT        - A debugger is waiting for this process to go
  226.  *                  onto the debug list.
  227.  *  PROC_SINGLE_STEP_FLAG    - The process will have the trace bit set
  228.  *                  before it runs.
  229.  *  PROC_MIG_PENDING        - The process will be migrated when it
  230.  *                  completes its next trap.
  231.  *  PROC_DONT_MIGRATE        - The process should not be migrated yet, even
  232.  *                  when it traps.
  233.  *  PROC_FOREIGN        - The process has been migrated from another
  234.  *                  workstation to this one.
  235.  *  PROC_DYING            - The process is comitting hari-kari.  
  236.  *                    Implies that PROC_NO_MORE_REQUESTS is 
  237.  *                    also set.
  238.  *  PROC_LOCKED            - This process is locked.
  239.  *  PROC_NEEDS_WAKEUP        - The process's thread needs to be resumed 
  240.  *                    as part of the cleanup from a "system call".
  241.  *  PROC_MIGRATING        - The process is in the middle of migrating
  242.  *                  to another workstation.  This happens after
  243.  *                  PROC_MIG_PENDING is set but before the
  244.  *                  process's state becomes PROC_MIGRATED and
  245.  *                  its PROC_MIGRATION_DONE flag is set.
  246.  *  PROC_MIGRATION_DONE        - indicates successful completion of a
  247.  *                  migration trap.
  248.  *  PROC_ON_DEBUG_LIST        - The process is on the debug list.
  249.  *  PROC_REMOTE_EXEC_PENDING    - The process should perform an exec as part
  250.  *                  of migration.
  251.  *  PROC_MIG_ERROR        - Indicates asynchronous error before
  252.  *                  migrating process context switches.
  253.  *  PROC_EVICTING        - Indicates process is being evicted
  254.  *                  (for statistics gathering).
  255.  *  PROC_KILLING        - Indicates we're trying to kill the process
  256.  *                  but it's in the debugger.  This is a
  257.  *                  big hack to get dbx to work.
  258.  *  PROC_BEING_SERVED        - The process has made a Sprite 
  259.  *                    request (or generated an exception), 
  260.  *                    which is being serviced.
  261.  *  PROC_NO_MORE_REQUESTS    - Future requests for the process 
  262.  *                    should be dropped on the floor.  If there
  263.  *                    is a pending request, it should try to
  264.  *                    bail out.  Note: the code that sets this 
  265.  *                    flag should also set the termReason, 
  266.  *                    termStatus, and termCode for the PCB.
  267.  */
  268.  
  269. typedef int Proc_Flags;
  270.  
  271. #define PROC_KERNEL            0x000001
  272. #define PROC_USER            0x000002
  273. #define PROC_DEBUGGED            0x000004
  274. #define PROC_DEBUG_ON_EXEC        0x000008
  275. #define PROC_SINGLE_STEP_FLAG        0x000010
  276. #define PROC_DEBUG_WAIT            0x000020
  277. #define PROC_MIG_PENDING        0x000040
  278. #define PROC_DONT_MIGRATE        0x000080
  279. #define PROC_FOREIGN            0x000100
  280. #define PROC_DYING            0x000200
  281. #define PROC_LOCKED            0x000400
  282. #define PROC_NEEDS_WAKEUP        0x000800 /* was PROC_NO_VM */
  283. #define PROC_MIGRATING            0x001000
  284. #define PROC_MIGRATION_DONE        0x002000
  285. #define PROC_ON_DEBUG_LIST        0x004000
  286. #define PROC_REMOTE_EXEC_PENDING    0x008000
  287. #define PROC_MIG_ERROR            0x010000
  288. #define PROC_EVICTING            0x020000
  289. #define PROC_KILLING            0x040000
  290. #define PROC_BEING_SERVED        0x080000
  291. #define PROC_NO_MORE_REQUESTS        0x100000
  292.  
  293. /* 
  294.  * The include's must come after the definition of Proc_State (and 
  295.  * possibly some other stuff as well).  Blech.
  296.  */
  297.  
  298. #ifndef _ASM
  299. #include <sprite.h>
  300. #include <spriteTime.h>
  301. #if defined(SPRITED) || defined(KERNEL)
  302. #include <user/sig.h>
  303. #include <user/vmTypes.h>
  304. #else
  305. #include <sig.h>
  306. #include <vmTypes.h>
  307. #endif
  308.  
  309. #endif /* _ASM */
  310.  
  311. #ifndef _ASM
  312.  
  313.  
  314. /*
  315.  *  Resource usage summary for a process. 
  316.  *  Used by Proc_Wait and Proc_GetResUsage.
  317.  *
  318.  *   Preliminary version: more fields will be added when needed.
  319.  *
  320.  *  Note: the cpu usage fields use the Time format. In the process
  321.  *  control block, they are stored in the Timer_Ticks format.
  322.  *  They are converted to Time format by the system calls that return
  323.  *  resource usage info.
  324.  */
  325.  
  326. typedef struct {
  327.     Time kernelCpuUsage;    /* How much time has been spent in kernel mode*/
  328.     Time userCpuUsage;        /* How much time has been spent in user mode. */
  329.  
  330.     Time childKernelCpuUsage;    /* Sum of time spent in kernel mode for 
  331.                  * all terminated children. */
  332.     Time childUserCpuUsage;    /* Sum of time been spent in user mode for
  333.                  * all terminated children. */
  334.     int    numQuantumEnds;        /* number of times the process was
  335.                  * context switched due to a quantum end. */
  336.     int numWaitEvents;        /* number of times the process was
  337.                       * context switched due to its waiting for
  338.                  *  an event. */
  339. } Proc_ResUsage;
  340.  
  341. /*
  342.  *  Request values for use with Proc_Debug system call.
  343.  */
  344.  
  345. typedef enum {
  346.     PROC_GET_THIS_DEBUG,
  347.     PROC_GET_NEXT_DEBUG,
  348.     PROC_CONTINUE,
  349.     PROC_SINGLE_STEP,
  350.     PROC_GET_DBG_STATE,
  351.     PROC_SET_DBG_STATE,
  352.     PROC_READ,
  353.     PROC_WRITE,
  354.     PROC_DETACH_DEBUGGER
  355. } Proc_DebugReq;
  356.  
  357. /*
  358.  * Flags to Proc_Wait
  359.  *
  360.  *         PROC_WAIT_BLOCK    -    Block if there if are no stopped or
  361.  *                terminated processes.
  362.  *    PROC_WAIT_FOR_SUSPEND - Return status of children that are suspended.
  363.  *                If this option isn't specified and children
  364.  *                are stopped then it is as though they are
  365.  *                still running.
  366.  */
  367. #define    PROC_WAIT_BLOCK        0x1
  368. #define    PROC_WAIT_FOR_SUSPEND    0x2
  369.  
  370. #define PROC_NUM_GENERAL_REGS 16
  371.  
  372. typedef struct {
  373.     Proc_PID    processID;        /* Process ID of debuggee */
  374.     int    termReason;            /* Reason why process has died or
  375.                      * it has been detached. */
  376.     int    termStatus;            /* Exit/detach status or signal number
  377.                      * that caused the process to die. */
  378.     int    termCode;            /* The code for the signal. */
  379.     thread_state_data_t regState;    /* The register state of the process. */
  380.     int    sigHoldMask;            /* Mask of signals to be held. */
  381.     int    sigPendingMask;            /* Mask of pending signals. */
  382.     int    sigActions[SIG_NUM_SIGNALS];     /* Array of the different types
  383.                        of actions for signals. */
  384.     int    sigMasks[SIG_NUM_SIGNALS];     /* Array of signal hold masks for 
  385.                        signal handlers. */
  386.     int    sigCodes[SIG_NUM_SIGNALS];     /* Array of signal handlers for 
  387.                        signals. */
  388.  
  389. } Proc_DebugState;
  390.  
  391. /*
  392.  * Structure that represents one environment variable.
  393.  */
  394.  
  395. typedef struct {
  396.     char *name;        /* Variable name. */
  397.     char *value;    /* Value for variable. */
  398. } Proc_EnvironVar;
  399.  
  400. /*
  401.  * Process information. Add new fields to the end of this structure!
  402.  */
  403. typedef struct  {
  404.     int        processor;    /* Processor number the process is running on
  405.                  * or wants to run on if the processor is
  406.                  * available.  */
  407.  
  408.     Proc_State    state;        /* Describes a process's current running state.
  409.                  * >>> See Proc_State definitions above. */ 
  410.  
  411.     int        genFlags;    /* Flags to describe a processes overall state.
  412.                  * >>> See definitions below */ 
  413.  
  414.     /*
  415.      *-----------------------------------------------------------------
  416.      *
  417.      *   Various Process Identifiers.
  418.      *    
  419.      *    Note that the user and effectiveUser ID are kept here because
  420.      *    they are used for permission checking in various places.  There
  421.      *    is also a list of group IDs which is kept in the filesystem state.
  422.      *
  423.      *-----------------------------------------------------------------
  424.      */
  425.  
  426.     Proc_PID    processID;        /* Actual process ID of this
  427.                      * process (for migrated processes
  428.                      * this is different than the PID
  429.                      * that the user sees). */
  430.     Proc_PID    parentID;        /* The process ID of the parent 
  431.                      * of this process. */
  432.     int        familyID;        /* The id of the process family that 
  433.                      * this process belongs to. */
  434.     int        userID;            /* The user id is used to check access
  435.                      * rights to files and check ability
  436.                      * to signal other processes. */
  437.     int        effectiveUserID;    /* The effective user id is used
  438.                      * for setuid access. */
  439.  
  440.     /*
  441.      *-----------------------------------------------------------------
  442.      *
  443.      *    Synchronization fields.
  444.      *
  445.      * Synchronization state includes an event the process is waiting on.
  446.      *
  447.      *-----------------------------------------------------------------
  448.      */
  449.     
  450.     int         event;         /* Address of the condition variable the 
  451.                   * process is waiting for. */ 
  452.  
  453.     /*
  454.      *-----------------------------------------------------------------
  455.      *
  456.      *    Scheduling fields.
  457.      *
  458.      *-----------------------------------------------------------------
  459.      */
  460.  
  461.  
  462.     int      billingRate;    /* Modifies the scheduler's calculation of
  463.                  * the processes priority.  */
  464.     unsigned int recentUsage;    /* Amount of CPU time used recently */
  465.     unsigned int weightedUsage;    /* Smoothed avg. of CPU usage, weighted by
  466.                  * billing rate. */
  467.     unsigned int unweightedUsage; /* Smoothed avg. of CPU usage, not weighted by
  468.                    * billing rate. */
  469.  
  470.     /*
  471.      *-----------------------------------------------------------------
  472.      *
  473.      *    Accounting and Resource Usage fields.
  474.      *
  475.      *-----------------------------------------------------------------
  476.      */
  477.  
  478.     Time kernelCpuUsage;    /* How much time has been spent in kernel mode*/
  479.     Time userCpuUsage;        /* How much time has been spent in user mode. */
  480.  
  481.     Time childKernelCpuUsage;    /* Sum of time spent in kernel mode for 
  482.                       * all terminated children. */
  483.     Time childUserCpuUsage;    /* Sum of time spent in user mode for
  484.                       * all terminated children. */
  485.     int     numQuantumEnds;        /* number of times the process was 
  486.                       * context switched due to a quantum 
  487.                      * end. */
  488.     int        numWaitEvents;        /* number of times the process was
  489.                      * context switched due to its waiting 
  490.                      * for an event. */
  491.     unsigned int schedQuantumTicks;    /* Number of clock ticks until this 
  492.                      * process is due to be switched out. */
  493.  
  494.     /*
  495.      *-----------------------------------------------------------------
  496.      *
  497.      *   Virtual Memory fields.
  498.      *
  499.      *-----------------------------------------------------------------
  500.      */
  501.     Vm_SegmentID        vmSegments[VM_NUM_SEGMENTS];
  502.  
  503.  
  504.     /*
  505.      *-----------------------------------------------------------------
  506.      *
  507.      *    Signals
  508.      *
  509.      *-----------------------------------------------------------------
  510.      */
  511.  
  512.     int        sigHoldMask;        /* Mask of signals to be held. */
  513.     int        sigPendingMask;        /* Mask of pending signals. */
  514.                         /* Array of the different types
  515.                        of actions for signals. */
  516.     int        sigActions[SIG_NUM_SIGNALS];
  517.                         /* Array of signal hold masks for 
  518.                        signal handlers. */
  519.     /*
  520.      *---------------------------------------------------------------------
  521.      *
  522.      * Data for process migration.
  523.      *
  524.      *---------------------------------------------------------------------
  525.      */
  526.     int        peerHostID;         /* If on home node, ID of remote node.
  527.                       * If on remote node, ID of home node.
  528.                       * If not migrated, undefined. */
  529.     Proc_PID    peerProcessID;         /* If on remote note, process ID on
  530.                       * home node, and vice-versa. */
  531.  
  532.     unsigned int machID;        /* for use with Mach ms, vminfo, etc */
  533. } Proc_PCBInfo;
  534.  
  535. /*
  536.  * Define the maximum length of the name and value of each enviroment
  537.  * variable and the maximum size of the environment.
  538.  */
  539.  
  540. #define    PROC_MAX_ENVIRON_NAME_LENGTH    4096
  541. #define    PROC_MAX_ENVIRON_VALUE_LENGTH    4096
  542. #define    PROC_MAX_ENVIRON_SIZE        100
  543.  
  544. /*
  545.  * Define the maximum size of the first line of an interpreter file.
  546.  */
  547.  
  548. #define PROC_MAX_INTERPRET_SIZE        80
  549.  
  550. /*
  551.  * Definitions for the Proc_G/SetIntervalTimer system calls.
  552.  *
  553.  * Currently, only 1 type of timer is defined:
  554.  *  PROC_TIMER_REAL -  time between intervals is real (a.k.a wall-clock) time.
  555.  *
  556.  * The values and the structure have the same values and layout as their 
  557.  * 4.3BSD equivalents.
  558.  */
  559.  
  560. #define PROC_TIMER_REAL        0
  561. /*
  562.  * not used yet.
  563. #define PROC_TIMER_VIRTUAL    1
  564. #define PROC_TIMER_PROFILE    2
  565. */
  566.  
  567. #define PROC_MAX_TIMER        PROC_TIMER_REAL
  568.  
  569. /* 
  570.  * Warning: if you change this struct, you should also update the MIG 
  571.  * definition of Proc_TimerInterval in spriteTypes.defs.
  572.  */
  573. typedef struct {
  574.     Time    interval;    /* Amount of time between timer expirations. */
  575.     Time    curValue;    /* Amount of time till the next expiration. */
  576. } Proc_TimerInterval;
  577.  
  578. /* 
  579.  * Size of the buffer containing arguments, to be passed back to users.  
  580.  */
  581.  
  582. #define PROC_PCB_ARG_LENGTH 256
  583.  
  584. /*
  585.  * The following structure is used to transfer fixed-length argument strings
  586.  * from the kernel back to user space.  A typedef simplifies later
  587.  * declarations (and may be the only way to do it?), since 
  588.  *    char *argPtr[PROC_PCB_ARG_LENGTH]
  589.  * would be an array of pointers to strings rather than an array of strings.
  590.  */
  591.  
  592. typedef struct {
  593.     char argString[PROC_PCB_ARG_LENGTH];
  594. } Proc_PCBArgString;
  595.  
  596.  
  597. /* 
  598.  * These definitions match the MIG definitions for moving argument and
  599.  * environment strings to the server for Exec.  The strings are passed in
  600.  * an array of bytes, with an array of offsets telling where each string
  601.  * begins.
  602.  */
  603.  
  604. typedef int Proc_StringOffset;
  605. typedef Proc_StringOffset *Proc_OffsetTable;
  606. typedef char *Proc_Strings;
  607.  
  608.  
  609. /*
  610.  * Define the state of this machine w.r.t accepting migrated processes.
  611.  * A machine must always be willing to accept its own processes if they
  612.  * are migrated home.  Other than that, a host may allow migrations onto
  613.  * it under various sets of criteria, and may allow migrations away from
  614.  * it under similar sets of criteria.
  615.  *
  616.  *    PROC_MIG_IMPORT_NEVER        - never allow migrations to this host.
  617.  *    PROC_MIG_IMPORT_ROOT         - allow migrations to this host only
  618.  *                      by root.
  619.  *    PROC_MIG_IMPORT_ALL          - allow migrations by anyone.
  620.  *    PROC_MIG_IMPORT_ANYINPUT     - don't check keyboard input when
  621.  *                      determining availability.
  622.  *    PROC_MIG_IMPORT_ANYLOAD      - don't check load average when
  623.  *                      determining availability.
  624.  *    PROC_MIG_IMPORT_ALWAYS      - don't check either.
  625.  *    PROC_MIG_EXPORT_NEVER        - never export migrations from this
  626.  *                       host.
  627.  *    PROC_MIG_EXPORT_ROOT            - allow only root to export.
  628.  *    PROC_MIG_EXPORT_ALL            - allow anyone to export.
  629.  *
  630.  * For example, a reasonable default for a file server might be to import
  631.  * and export only for root; for a user's machine, it might be to allow
  632.  * anyone to migrate; and for a compute server, it might never export
  633.  * and import always regardless of load average or keyboard input.  (The
  634.  * load average would not have to be exceptionally low to determine
  635.  * availability; the host still would only be selected if the load average
  636.  * were low enough to gain something by migrating to it.)
  637.  */
  638.  
  639. #define PROC_MIG_IMPORT_NEVER              0
  640. #define PROC_MIG_IMPORT_ROOT        0x00000001
  641. #define PROC_MIG_IMPORT_ALL         0x00000003
  642. #define PROC_MIG_IMPORT_ANYINPUT    0x00000010
  643. #define PROC_MIG_IMPORT_ANYLOAD        0x00000020
  644. #define PROC_MIG_IMPORT_ALWAYS  \
  645.             (PROC_MIG_IMPORT_ANYINPUT | PROC_MIG_IMPORT_ANYLOAD)
  646. #define PROC_MIG_EXPORT_NEVER             0
  647. #define PROC_MIG_EXPORT_ROOT        0x00010000
  648. #define PROC_MIG_EXPORT_ALL        0x00030000
  649.  
  650. #define PROC_MIG_ALLOW_DEFAULT (PROC_MIG_IMPORT_ALL | PROC_MIG_EXPORT_ALL)
  651.  
  652. /*
  653.  * Library call declarations.
  654.  */
  655.  
  656. extern ReturnStatus Proc_SetExitHandler();
  657. extern void        Proc_Exit();
  658.  
  659. /*
  660.  * System call declarations.
  661.  */
  662.  
  663. extern ReturnStatus Proc_Fork();
  664. extern ReturnStatus Proc_Detach();
  665. extern ReturnStatus Proc_Wait();
  666. extern ReturnStatus Proc_RawWait();
  667. extern ReturnStatus Proc_ExecStub();
  668. extern ReturnStatus Proc_ExecEnvStub();
  669.  
  670. extern ReturnStatus Proc_GetIDsStub();
  671. extern ReturnStatus Proc_SetIDs();
  672. extern ReturnStatus Proc_GetGroupIDs();
  673. extern ReturnStatus Proc_SetGroupIDs();
  674. extern ReturnStatus Proc_GetFamilyID();
  675. extern ReturnStatus Proc_SetFamilyID();
  676.  
  677. extern ReturnStatus Proc_GetPCBInfo();
  678. extern ReturnStatus Proc_GetResUsage();
  679. extern ReturnStatus Proc_GetPriority();
  680. extern ReturnStatus Proc_SetPriority();
  681.  
  682. extern ReturnStatus Proc_Debug();
  683. extern ReturnStatus Proc_Profile();
  684.  
  685. extern ReturnStatus Proc_SetIntervalTimer();
  686. extern ReturnStatus Proc_GetIntervalTimer();
  687.  
  688. extern ReturnStatus Proc_SetEnviron();
  689. extern ReturnStatus Proc_UnsetEnviron();
  690. extern ReturnStatus Proc_GetEnvironVar();
  691. extern ReturnStatus Proc_GetEnvironRange();
  692. extern ReturnStatus Proc_InstallEnviron();
  693. extern ReturnStatus Proc_CopyEnviron();
  694.  
  695. extern ReturnStatus Proc_Migrate();
  696.  
  697. /* 
  698.  * For initial debugging, have the server share a page of memory with 
  699.  * all its clients.  This is the starting address of it.
  700.  */
  701. #define PROC_SHARED_REGION_START 0x1000000 
  702.     
  703. #endif /* _ASM */
  704.  
  705. #endif /* _PROCUSER */
  706. @
  707.  
  708.  
  709. 1.7
  710. log
  711. @Add warning about changing Proc_TimerInterval.
  712. @
  713. text
  714. @d15 1
  715. a15 1
  716.  * $Header: /user5/kupfer/spriteserver/include/user/RCS/proc.h,v 1.6 92/02/28 19:54:20 kupfer Exp Locker: kupfer $ SPRITE (Berkeley)
  717. d536 12
  718. @
  719.  
  720.  
  721. 1.6
  722. log
  723. @Support for signals.  Put back PROC_RUNNING (compatibility).  Record
  724. MachID number for user processes.
  725. @
  726. text
  727. @d15 1
  728. a15 1
  729.  * $Header: /r3/kupfer/spriteserver/include/user/RCS/proc.h,v 1.5 91/12/18 21:46:01 kupfer Exp Locker: kupfer $ SPRITE (Berkeley)
  730. d510 4
  731. @
  732.  
  733.  
  734. 1.5
  735. log
  736. @Enable definition of Proc_PCBInfo and fix up include's.
  737. @
  738. text
  739. @d15 1
  740. a15 1
  741.  * $Header: /r3/kupfer/spriteserver/include/user/RCS/proc.h,v 1.4 91/10/04 11:53:14 kupfer Exp Locker: kupfer $ SPRITE (Berkeley)
  742. d21 2
  743. d31 1
  744. a31 1
  745.  *                  invalid as a result of a user level error.
  746. d56 4
  747. d66 2
  748. d140 1
  749. a312 1
  750. #if 0
  751. d320 1
  752. a320 1
  753.     Mach_RegState regState;        /* The register state of the process. */
  754. a330 1
  755. #endif /* 0 */
  756. d472 2
  757. @
  758.  
  759.  
  760. 1.4
  761. log
  762. @Ditch PROC_NO_VM, add PROC_NEEDS_WAKEUP.  Add note to
  763. PROC_NO_MORE_REQUESTS about setting termination info.  Change proc
  764. declarations to track new names for server calls.
  765. @
  766. text
  767. @d15 1
  768. a15 1
  769.  * $Header: /r3/kupfer/spriteserver/include/user/RCS/proc.h,v 1.3 91/09/24 19:48:20 kupfer Exp Locker: kupfer $ SPRITE (Berkeley)
  770. a20 1
  771.  
  772. d233 2
  773. a234 3
  774. #if 0
  775. #ifdef SPRITED
  776. #include <sigTypes.h>
  777. d237 1
  778. a237 1
  779. #include <sprited/sigTypes.h>
  780. a239 1
  781. #endif /* 0 */
  782. a336 1
  783. #if 0
  784. d383 3
  785. a385 2
  786.  
  787.     int         event;         /* Event # the process is waiting for. */
  788. a465 1
  789. #endif /* 0 */
  790. @
  791.  
  792.  
  793. 1.3
  794. log
  795. @Merge in a bunch of native Sprite stuff, and make changes to support
  796. multithreading in the server.
  797. @
  798. text
  799. @d15 1
  800. a15 1
  801.  * $Header: /user6/kupfer/spriteserver/include/user/RCS/proc.h,v 1.2 91/09/01 21:15:32 kupfer Exp Locker: kupfer $ SPRITE (Berkeley)
  802. d172 2
  803. a173 2
  804.  *  PROC_NO_VM            - The virtual memory resources have been
  805.  *                  freed up for this user process.
  806. d197 3
  807. a199 1
  808.  *                    bail out.
  809. d215 1
  810. a215 1
  811. #define PROC_NO_VM            0x000800
  812. d587 2
  813. a588 2
  814. extern ReturnStatus Proc_Exec();
  815. extern ReturnStatus Proc_ExecEnv();
  816. d590 1
  817. a590 1
  818. extern ReturnStatus Proc_GetIDs();
  819. @
  820.  
  821.  
  822. 1.2
  823. log
  824. @Add a bunch of stuff from the native user/proc.h.
  825. @
  826. text
  827. @d15 1
  828. a15 1
  829.  * $Header: /user6/kupfer/spriteserver/include/user/RCS/proc.h,v 1.1 91/08/15 18:33:07 kupfer Exp Locker: kupfer $ SPRITE (Berkeley)
  830. d21 3
  831. a23 2
  832. /* 
  833.  * Process attributes flags:
  834. d25 36
  835. a60 6
  836.  *  PROC_KERNEL               - The process is a kernel process.
  837.  *  PROC_USER                 - The process is a user process.
  838.  */
  839.  
  840. #define PROC_KERNEL            0x00001
  841. #define PROC_USER            0x00002
  842. a61 6
  843. /* 
  844.  * For initial debugging, have the server share a page of memory with 
  845.  * all its clients.  This is the starting address of it.
  846.  */
  847. #define PROC_SHARED_REGION_START 0x1000000 
  848.     
  849. d69 2
  850. d144 6
  851. d168 3
  852. a170 1
  853.  *  PROC_DYING            - The process is comitting hari-kari.
  854. d191 7
  855. d202 410
  856. a611 19
  857. #define PROC_KERNEL            0x00001
  858. #define PROC_USER            0x00002
  859. #define PROC_DEBUGGED            0x00004
  860. #define PROC_DEBUG_ON_EXEC        0x00008
  861. #define PROC_SINGLE_STEP_FLAG        0x00010
  862. #define PROC_DEBUG_WAIT            0x00020
  863. #define PROC_MIG_PENDING        0x00040
  864. #define PROC_DONT_MIGRATE        0x00080
  865. #define PROC_FOREIGN            0x00100
  866. #define PROC_DYING            0x00200
  867. #define PROC_LOCKED            0x00400
  868. #define PROC_NO_VM            0x00800
  869. #define PROC_MIGRATING            0x01000
  870. #define PROC_MIGRATION_DONE        0x02000
  871. #define PROC_ON_DEBUG_LIST        0x04000
  872. #define PROC_REMOTE_EXEC_PENDING    0x08000
  873. #define PROC_MIG_ERROR            0x10000
  874. #define PROC_EVICTING            0x20000
  875. #define PROC_KILLING            0x40000
  876. d613 1
  877. d615 6
  878. @
  879.  
  880.  
  881. 1.1
  882. log
  883. @Initial revision
  884. @
  885. text
  886. @d15 1
  887. a15 1
  888.  * $Header: /sprite/lib/forms/RCS/proto.h,v 1.7 91/02/09 13:24:52 ouster Exp $ SPRITE (Berkeley)
  889. d22 10
  890. a43 2
  891.  
  892.  
  893. d116 64
  894. @
  895.